# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer:
pkgname=dxvk
pkgver=1.7
pkgrel=0
pkgdesc="Vulkan-based compatibility layer for Direct3D 10/11"
options="!check"
url="https://github.com/doitsujin/dxvk"
arch="x86_64 x86"
license="Zlib"
depends="bash wine"
makedepends="
	meson
	glslang-dev
	mingw-w64-gcc
	wine-dev
	vulkan-loader
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/doitsujin/dxvk/archive/v$pkgver.tar.gz"

case "$CARCH" in
	x86_64)
		_outdir=build/x64
		_crossfile=build-win64.txt
		_prefix=/usr/share/dxvk/x64
		;;
	x86)
		_outdir=build/x32
		_crossfile=build-win32.txt
		_prefix=/usr/share/dxvk/x32
		;;
esac

build() {
	meson . $_outdir \
		--cross-file=$_crossfile \
		--prefix=$_prefix \
		--bindir="" \
		--libdir="" \
		--buildtype=plain \
		-Denable_tests=false
	ninja -C $_outdir
}

package() {
	DESTDIR="$pkgdir" ninja -C $_outdir install
	install -Dm644 setup_dxvk.sh "$pkgdir"/usr/share/dxvk/setup_dxvk.sh
	mkdir -p "$pkgdir"/usr/bin
	ln -s /usr/share/dxvk/setup_dxvk.sh "$pkgdir"/usr/bin/setup_dxvk
	chmod +x "$pkgdir"/usr/share/dxvk/setup_dxvk.sh
}
sha512sums="3a78332dbaaed71fb007ef9b441b33892bd56844dfddc72ded926108712ade34060ddb850bf3943b175aed6e89d453fb84f12fe9c00a94e03a342de61d7aed0c  dxvk-1.7.tar.gz"
